if (typeof jmaki.GoogleMapWrapper == 'undefined') {
    jmaki.GoogleMapWrapper = function(_widget) {
        
        var containerDiv = document.getElementById(_widget.uuid);
        var zoom = 13;
        var centerLat = 37.4419;
        var centerLon = -122.1419;
        
        var mapType = G_SATELLITE_TYPE;
        var mapH = 0;
        var mapW = 0;
        
        
        if (typeof _widget.args != 'undefined') {
            if (typeof _widget.args.zoom != 'undefined') {
                zoom = Number(_widget.args.zoom);
            }
            
            if (typeof _widget.args.zoom != 'undefined') {
                zoom = Number(_widget.args.zoom);
            }
            
            if (_widget.args.centerLat != 'undefined') {
                centerLat = Number(_widget.args.centerLat);
            }
            if (typeof _widget.args.centerLon != 'undefined') {
                centerLon = Number(_widget.args.centerLon);
            }
            
            if (typeof _widget.args.height != 'undefined') {
                mapH = Number(_widget.args.height);
                containerDiv.style.height = mapH + "px";
            }
            
            if (typeof _widget.args.width != 'undefined') {
                mapW = Number(_widget.args.width);
                containerDiv.style.width = mapW + "px";
            }
            
            if (typeof _widget.args.mapType != 'undefined') { 
                if (_widget.args.mapType == 'REGULAR') {
                    mapType = G_NORMAL_MAP;
                } else if (_widget.args.mapType == 'SATELLITE') {
                    mapType = G_SATELLITE_TYPE;
                } else if (_widget.args.mapType == 'HYBRID') {
                    mapType = G_HYBRID_MAP;
                }
            }
        }
        if (mapH == 0) {
            mapH = containerDiv.offsetHeight;
            // if all else fails give it a height of 300
            if (mapH ==0) mapH = 300;
            containerDiv.style.height = mapH + "px";
        }
        
        this.map = new GMap2(containerDiv);
        this.map.setCenter(new GLatLng(centerLat, centerLon), zoom);
        this.map.addControl(new GSmallMapControl());
        this.map.addControl(new GMapTypeControl());
        this.map.setMapType(mapType);
    }
}

var gw = new jmaki.GoogleMapWrapper(widget);
jmaki.attributes.put(widget.uuid, gw);